﻿@model Questions
@{
    ViewBag.Title = ViewData.WriteIf("isEdit", Model.Title, "创建问题");
}

<script src="@Url.Content("~/scripts/ASK/Edit.js")" type="text/javascript"></script>
<script src="@Url.Content("~/scripts/Libs/jQuery.PoshyTip/jquery.poshytip.min.js")" type="text/javascript"></script>

@Html.Stylesheet("~/styles/ASK/main.css")
@Html.Stylesheet("~/styles/ASK/Edit.css")
@Html.Stylesheet("~/styles/Libs/jQuery.PoshyTip/tip-yellow/tip-yellow.css")

<ul class="path floatContainer">
	<li class="first">@Html.ActionLinkLocalized("途丫问答", "List", "Ask")</li>
	<li>@Html.ActionLink("Create", "EditQuestion", "Ask", new { question = Model.Id }, null)</li>
</ul>

<div class="main">
  <div class="ask_wp">
        <div class="ask_top_detail">
        <h2>
            <a href="@Url.Action("List","Ask")"><img src="@Url.Content("~/styles/ASK/images/ask_title_txt.png")" alt="途丫问答" title="i途丫问答"></a>
        </h2>

        <div class="ask_search_main">
              <div class="ask_search_text">
				<input id="type" name="type" type="hidden" value="orther">
				<form action="/search" method="get" id="formsearch">
                    <input id="keyword" name="q" type="text" style="width: 420px; color: rgb(149, 149, 149); " value="" placeholder="提问前请先搜索，看看你的问题其他穷游er是否已经问过" class="ui_input" autocomplete="off">
                    <input type="button" value=" " onclick="if($.trim($('#keyword').val())!='' &amp;&amp; $.trim($('#keyword').val())!='提问前请先搜索，看看你的问题其他穷游er是否已经问过'){$('#formsearch').submit();}" class="ask_button">
				</form>
				<div id="search_menu"></div>
            </div>		
        </div>

        <div class="ask_alltag fl">
        	<a href="@Url.Action("AllTags","Ask")">全部标签</a>
        </div>

        <div class="ask_askhelp_btn">
            <a rel="nofollow" href="@Url.Action("AddQuestion","Ask")"><img src="@Url.Content("~/styles/ASK/images/ask_addask_btn.png")"/></a>
        </div>

        </div>
  </div>
<div class="ask_item mt10">
@{Html.BeginForm(null, null, null, FormMethod.Post, new{@id="questionEditForm"});}
@Html.AntiForgeryToken()
<fieldset>
	<div class="ask_item_main fl">
        <h4 class="fb f14 cGray ask_quiz_title">问题标题</h4>
        <div class="ask_item_main_quiz">
            	<div class="ask_quiz_pr">
                    @Html.TextBoxFor(q=>q.Title,new{@id="title", @name="title", @class="ui_input ask_item_main_quiz_input js_inputGap jstitle"})
                </div>
                <div class="cGray mt5 pl10"><span class="js_title_num">0</span> / 50 字  
                    <span class="js_title_error">@Html.ValidationSummaryOne("Title", new Dictionary<string, object>{
                                                {"Title", 
                                                new Dictionary<ValidationErrorType, string>(){{ValidationErrorType.NullOrEmpty,"标题不能为空"},
                                                                                              {ValidationErrorType.MaxLength,"长度不大于50个字符"}
                                                                                             }} 
                                                }, null)</span>
                </div>
            </div>
        <h4 class="fb f14 mt20 cGray ask_quiz_title">问题详细内容</h4>
        <div class="ask_item_main_quiz">
            <div class="mod_edittext">
                @Html.TextAreaFor(q=>q.Description,new{@id="questionBody",@class="edittext_body"})
            </div>
            <div class="cGray mt5 pl10"><span class="js_content_num">0</span> / 500 字  
                <span class="js_content_error">@Html.ValidationSummaryOne("Description", new Dictionary<string, object>{
                                                {"Description", "长度不大于500个字符"}
                                                }, null)</span>
            </div>
        </div>
        <h4 class="fb f14 mt20 cGray ask_quiz_title">添加问题标签</h4>
        <div id="tagsList" class="ask_tagmain_list ask_tagmain_list_quiz clearfix">
               <span id="taglist"></span>
               <div class="ask_tag_select js_ask_tag_select"><input type="text" placeholder="添加标签" class="ui_input mt5 mb5 js_addtaginput1"><span id="tagmenu"></span></div>
        </div>
        <span class="js_content_error">@Html.ValidationSummaryOne("Tags", new Dictionary<string, object>{
                                                {"Tags", "标签不能为空"}
                                                }, null)</span>

        <input type="hidden" name="oldtag" id="oldtag" value=""/>
		<input type="hidden" name="oldtitle" id="oldtitle" value="@Model.Title"/>
        <input type="hidden" name="oldcontent" id="oldcontent" value="@Model.Description"/>
        <input type="hidden" id="id" name="id" value="@Model.Id"/>
        <input type="hidden" id="oldfid" name="oldfid" value="0"/>
        <input type="hidden" id="fid" name="fid" value="0"/>
        <input type="hidden" id="tid" name="tid" value=""/>

        @if (this.Config.Notifications.Subscription.IsDefined)
        {
	    <div class="formItem floatContainer">
		<div class="checkbox">
			@Html.CheckBox("notify", new { onclick = "toggleEmail();" })
			<label for="notify">当有人回答时通过邮件通知我</label>
			@(this.User.Email == null ? Html.TextBox("email", null, new { @class = "notifyEmail", @style = "display:none;" }) : MvcHtmlString.Empty)
		</div>
	    </div>
        }
        else
        {
		    @Html.Hidden("notify", false)
        }

    <div class="clearfix mt10 ask_tagmain_list_quiz_btn">
		<input type="submit" class="ui_button14 fr" value="发表问题" />
        
        <a href="javascript:history.back(-1);" class="fr mt5 mr10">取消</a>
	</div>
    </div>

</fieldset>
@{Html.EndForm();}
</div>
</div>